FROM golang:1.21rc2-alpine3.18

ENV WEB_PATH /home
WORKDIR $WEB_PATH
COPY . .

RUN echo "https://mirrors.cloud.tencent.com/alpine/v3.18/main" > /etc/apk/repositories && \
    echo "https://mirrors.cloud.tencent.com/alpine/v3.18/community" >> /etc/apk/repositories \

RUN export CGO_ENABLED=0 && export GOARCH=amd64 && export GOOS=linux && go build -o /usr/bin/rangine *.go
RUN mkdir /etc/rangine/ && cp config.yaml /etc/rangine/config.yaml
RUN rm -rf /home/*

CMD rangine server:start -f /etc/rangine/config.yaml \
 -e redis.default.host=${REDIS_HOST} \
 -e redis.default.password=${REDIS_PASSWORD} \
 -e redis.default.port=${REDIS_PORT} \
 -e setting.queue=${SETTING_QUEUE}

# 服务暴露的端口
EXPOSE 8084

